package com.gaoyubo.controller;

import com.gaoyubo.entity.Insurance;
import com.gaoyubo.entity.Insurance_type;
import com.gaoyubo.entity.SearchVo;
import com.gaoyubo.service.InsuranceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
public class InsuranceController {
    @Autowired
    private InsuranceService insuranceService;
    //列表模糊分页
    @RequestMapping("list")
    public Page<Insurance> findAll(@RequestParam(defaultValue = "1")Integer pageNum,
                                   @RequestParam(defaultValue = "3")Integer pageSize,
                                   SearchVo searchVo) {
        System.out.println(searchVo);
        return insuranceService.findAll(pageNum,pageSize,searchVo);
    }
    //类型
    @RequestMapping("getTypeList")
    public List<Insurance_type> insuranceTypeList(){
        return insuranceService.insuranceTypeList();
    }

}
